#!/bin/bash

[ "$1" ] && EXAMPLE=$1 || EXAMPLE=hello
WT_BASE_DIR=`pwd`


cd $WT_BASE_DIR/build
#cmake ..              || exit
make -j2              || exit
#make -j2 -C examples/ || exit
cd examples/$EXAMPLE/ || exit
make -j2              || exit


cd $WT_BASE_DIR/examples/$EXAMPLE/
[ -L ./resources ] || ln -s $WT_BASE_DIR/resources ./resources
$WT_BASE_DIR/build/examples/$EXAMPLE/$EXAMPLE.wt --docroot . --http-address 0.0.0.0 --http-port 8080
cd $WT_BASE_DIR/
